home *** CD-ROM | disk | FTP | other *** search
/ Go Ronald / Go Ronald Voice Interactive CD.iso / Data1.cab / _8D088414393A4AB0BB2239714C0C0C0B / scripts / frame_20 / DoAction.as
Text File  |  2005-08-05  |  2KB  |  82 lines

  1. function interval()
  2. {
  3.    RunBG._x -= nBotSpeed * 3;
  4.    bot_mc._x += nBotSpeed + 5;
  5.    mApplication.trace("ronald\'s x pos : " + RunBG._x);
  6.    if(RunBG._x < -300)
  7.    {
  8.       mApplication.trace("jump in");
  9.       bot_mc.gotoAndPlay("jumpin");
  10.       clearInterval(id);
  11.    }
  12.    else
  13.    {
  14.       mApplication.trace("don\'t jump in");
  15.    }
  16. }
  17. function enterWithMic()
  18. {
  19.    if(active_mic.activityLevel < nPrevMicLevel & bWasGoingUp)
  20.    {
  21.       mApplication.trace("GO GO GO");
  22.       bWasGoingUp = false;
  23.       if(!nBotSpeed)
  24.       {
  25.          nBotSpeed = 7;
  26.       }
  27.       else
  28.       {
  29.          nBotSpeed += Math.round(nPrevMicLevel / 20);
  30.       }
  31.    }
  32.    if(active_mic.activityLevel > nPrevMicLevel)
  33.    {
  34.       bWasGoingUp = true;
  35.    }
  36.    nPrevMicLevel = active_mic.activityLevel;
  37.    RunBG._x -= nBotSpeed * 3;
  38.    bot_mc._x += nBotSpeed + 5;
  39.    if(RunBG._x < -300)
  40.    {
  41.       this.onEnterFrame = null;
  42.       bot_mc.gotoAndPlay("jumpin");
  43.    }
  44. }
  45. stop();
  46. var nBotSpeed = 7;
  47. x = 0;
  48. Timer._visible = false;
  49. Timer.gotoAndPlay("Start");
  50. gogogo_mc.enabled = true;
  51. bot_mc.gotoAndPlay(2);
  52. gogogo_mc.onRelease = function()
  53. {
  54.    mApplication.trace("click go go go ");
  55.    if(!nBotSpeed)
  56.    {
  57.       nBotSpeed = 7;
  58.    }
  59.    else
  60.    {
  61.       nBotSpeed += Math.round(Math.random() * 5) + 3;
  62.    }
  63. };
  64. if(userHasMic)
  65. {
  66.    var nPrevMicLevel = 0;
  67.    var active_mic = Microphone["get"]();
  68.    var bWasGoingUp = false;
  69.    this.createEmptyMovieClip("sound_mc",this.getNextHighestDepth());
  70.    sound_mc.attachAudio(active_mic);
  71.    var inputSound = new Sound(sound_mc);
  72.    inputSound.setVolume(0);
  73.    this.onEnterFrame = function()
  74.    {
  75.       enterWithMic();
  76.    };
  77. }
  78. else
  79. {
  80.    var id = setInterval(interval,80);
  81. }
  82.